//
//  Region.m
//  SeaMelonSeeds_Counselor
//
//  Created by 杨笑 on 2017/9/22.
//  Copyright © 2017年 杨笑. All rights reserved.
//

#import "Region.h"

@implementation Region
-(void)setValue:(id)value forKey:(NSString *)key{
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"list"]) {
        NSMutableArray *array = [NSMutableArray new];
        for (NSDictionary *dict in value) {
            Region *region = [Region new];
            [region setValuesForKeysWithDictionary:dict];
            [array addObject: region];
        }
        self.listArray = array;
    }
}
-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}

//@property (nonatomic, assign) NSInteger     id;
//@property (nonatomic, assign) NSInteger     pid;//父id
//@property (nonatomic, assign) NSInteger     no;//编号
//@property (nonatomic, strong) NSString     *name;
//@property (nonatomic, assign) NSInteger     level;
//@property (nonatomic, strong) NSArray      *listArray;//子区域
-(id)copyWithZone:(NSZone *)zone{
    Region *instance = [[Region alloc]init];
    if (instance) {
        instance.id = self.id;
        instance.pid = self.pid;
        instance.no = self.no;
        instance.name = [self.name copyWithZone:zone];
        instance.level = self.level;
        instance.listArray = [self.listArray copyWithZone:zone];
    }
    return instance;
}
@end
